home *** CD-ROM | disk | FTP | other *** search
- /* Listing 1 */
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #define PAL_LEN 256
-
- typedef struct
- {
- int red;
- int grn;
- int blu;
- int num;
- } pal;
-
- pal palo[ PAL_LEN ]; /* original palette */
- pal pals[ PAL_LEN ]; /* sorted palette */
-
- /* index for the sorted palette */
- int redindex[ PAL_LEN ];
-
- /* prototypes */
-
- int closest( int red, int green, int blue );
- long dist( int red, int green, int blue, int num );
- void sort_color();
- int color_comp( const void *a, const void *b );